package domain;

import java.math.BigDecimal;

public class CashDispenserImpl implements  CashDispenser{
    private BigDecimal cash;

    public CashDispenserImpl(BigDecimal cash) {
        super();
        this.cash = cash;
    }

    /* 吐钞
     * @see domain.CashDispenser#spitOutCash(double)
     */
    @Override
    public void dispenseCash(BigDecimal amount) {
        if(cash.compareTo(amount)==1){
            this.cash =this.cash.subtract(amount);
        }
        ; //模拟吐钞口打开
        //模拟吐钞
    }

    /* 关闭吐钞出口。模拟现金被取走
     * @see domain.CashDispenser#closeDispenser()
     */
    public void closeDispenser() {


    }

}
